import { staticRoutes } from '@/router/routes'
import { defineStore } from 'pinia'
import type { RouteRecordRaw } from 'vue-router'

export interface UserInfoParams {
    username: string,
    password: string
}
export interface LoginData {
    token: string
}
export interface UserInfoData {
    name: string,
    avatar: string,
    buttons: string[],
    routes: string[],
    roles: string[]
}

type UserInfoStoreState = {
    token: string,
    userInfo: UserInfoData,
    menuRoutes: RouteRecordRaw[]
}

function initUserInfo(): UserInfoData {
    return {
        name: '',
        avatar: '',
        buttons: [],
        roles: [],
        routes: []
    }
}

export const useUserInfoStore = defineStore('userInfo', {
    state(): UserInfoStoreState {
        return {
            token: '',
            userInfo: initUserInfo(),
            menuRoutes: staticRoutes
        }
    },
    actions: {
        getInfo() {

        },

        reset() {

        },
    }
})
